﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media;

namespace Techdays2013.Controls
{
    public partial class Tile : UserControl
    {
        public Tile()
        {
            InitializeComponent();

            this.LayoutRoot.DataContext = this;
        }

        /// <summary>
        /// Text
        /// </summary>

        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(Tile), new PropertyMetadata(null));

        /// <summary>
        /// Source de l'icone
        /// </summary>

        public ImageSource IconSource
        {
            get { return (ImageSource)GetValue(IconSourceProperty); }
            set { SetValue(IconSourceProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IconSource.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IconSourceProperty =
            DependencyProperty.Register("IconSource", typeof(ImageSource), typeof(Tile), new PropertyMetadata(null));

        /// <summary>
        /// Clique sur le bouton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void LayoutRoot_Click_1(object sender, RoutedEventArgs e)
        {
            if (Click != null)
            {
                Click(this, null);
            }
        }

        /// <summary>
        /// Click
        /// </summary>

        public event RoutedEventHandler Click = null;
    
    }
}
